package com.cqjtu.eecs.service.impl;

import com.cqjtu.eecs.entity.Project;
import com.cqjtu.eecs.entity.TrainingGoal;
import com.cqjtu.eecs.entity.vo.TrainingGoalTemplateVO;
import com.cqjtu.eecs.entity.vo.TrainingGoalVO;
import com.cqjtu.eecs.mapper.ProjectMapper;
import com.cqjtu.eecs.mapper.TrainingGoalMapper;
import com.cqjtu.eecs.mapper.TrainingGoalTemplateMapper;
import com.cqjtu.eecs.service.ITrainingGoalService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 培养目标 服务实现类
 * </p>
 *
 * @author    
 * @since 2022-03-07
 */
@Service
public class TrainingGoalServiceImpl extends ServiceImpl<TrainingGoalMapper, TrainingGoal> implements ITrainingGoalService {

    @Autowired
    private TrainingGoalMapper trainingGoalMapper;

    @Autowired
    private ProjectMapper projectMapper;

    @Override
    public TrainingGoalVO getTrainingGoalVO(String pid) {
        try {
            TrainingGoalVO trainingGoalVO = new TrainingGoalVO();
            String trainingGoalBrief = projectMapper.getTrainingGoalBrief(pid);
            trainingGoalVO.setTrainingGoalBrief(trainingGoalBrief);
            List<TrainingGoalTemplateVO> trainingGoalTemplateVOList = trainingGoalMapper.getTrainingGoal(pid);
            trainingGoalVO.setTrainingGoalTemplateVO(trainingGoalTemplateVOList);
            return trainingGoalVO;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
